package com.syp.hehe.util;
import java.util.HashMap;
import java.util.Map;


public class ThreadCache {
	
	private static final ThreadLocal<Map<String, Object>> cache = new ThreadLocal<Map<String, Object>>();
	
	public static void put(String key,Object value) {
		Map<String, Object> m = cache.get();
		if( m == null){
			m = new HashMap<String, Object>();
			cache.set(m);
		}
		m.put(key, value);
	}

	public static Object get(String key) {
		Map<String, Object> m = cache.get();
		if( m == null){
			return null;
		}
		return m.get(key);
	}

	public static Map<String, Object> getAll() {
		return cache.get();
	}

}
